import StatusBar from '../index.js'

class UpDown extends StatusBar {
  constructor(node) {
    super(node)
    this.node = node
  }
  renderItem(params) {
    const { value } = params
    let classObj = {
      up: '',
      down: ''
    }
    if (value === 1) {
      classObj.up = 'active'
      classObj.down = ''
    } else if (value === 2) {
      classObj.up = ''
      classObj.down = 'active'
    } else if (value === 3) {
      classObj.up = 'active'
      classObj.down = 'active'
    }
    let dom = ''
    dom += `<i class="platformicon iconicon_shangchuan ${classObj.up}"></i><i class="platformicon iconicon_xiazai ${classObj.down}"></i>`

    return dom
  }
  //渲染弹出框dom
  renderPopupDom(params) {
    let dom = `<div class="popup-wrapper" style="width: ${params.popupWidth}">
                        <ul class="popup-list">`

    if (params.popupList[0].value === 0) {
      params.popupList[0].name = '暂无数据传输'
    }
    if (params.popupList[0].value === 1) {
      params.popupList[0].name = '当前仅有数据上传'
    }
    if (params.popupList[0].value === 2) {
      params.popupList[0].name = '当前仅有数据下载'
    }
    if (params.popupList[0].value === 3) {
      params.popupList[0].name = '数据上传及下载'
    }
    params.popupList &&
      params.popupList.forEach((item, i) => {
        dom += `<li class="popup-list-item">
                        <span class="popup-item-name">${item.name}</span>
                    </li>`
      })

    dom =
      dom +
      `</ul>
                        <div class="arrow"></div>
                    </div>`
    return dom
  }
}
export default UpDown
